import com.dinmax.flash.gsa.communication.action.*
import com.dinmax.flash.gsa.communication.*

class Action implements ActionInterface{
	
	private var name:String="Action";

	public function getName():String{
		return this.name;
	};
	
	public function toXML(body:Boolean):String{
		var xml_str:String="";
		if(body==true || body==undefined) xml_str+='<?xml version="1.0" encoding="UTF-8"?>';
		xml_str+='<ACTION NAME="'+getName()+'" />';
		return xml_str;
	};
	
	public function execute():CommunicationEvent {
		return undefined;
	};

	public function getNode(node:XMLNode, name:String):Array {
		
		if (node.hasChildNodes()) {
		// use firstChild to iterate through the child nodes of rootNode
		 var nodes:Array=new Array();
		 for (var aNode:XMLNode = node.firstChild; aNode != null; aNode=aNode.nextSibling) {
				if (aNode.nodeType == 1 && aNode.nodeName==name) {
					nodes.push(aNode);
				}
		  }
		  if(nodes.length > 0) return nodes; return undefined;
		}

	};

	public function getAttribute(node:XMLNode, attribute:String):String {
		for(var sNested:String in node.attributes){
			if(sNested == attribute){
				return (node.attributes[sNested]);
			}
		}
		return undefined;
	};

}; // fin de clase